package me.sdevil507.biz.screen.controller;

import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.extern.slf4j.Slf4j;
import me.sdevil507.biz.screen.dto.ScreenActiveResultDTO;
import me.sdevil507.biz.screen.dto.ScreenSearchConditionDTO;
import me.sdevil507.biz.screen.service.ScreenService;
import me.sdevil507.org.service.OrgService;
import me.sdevil507.supports.result.ApiResultDTO;
import me.sdevil507.supports.result.ApiResultGenerator;
import me.sdevil507.supports.shiro.helper.OrgAccountHelper;
import me.sdevil507.supports.shiro.helper.ServiceAccountHelper;
import me.sdevil507.supports.status.ApiStatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * @Author hp
 * @Date 2021/2/24 10:37
 * @Description 消费端一屏看
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/org/screen")
@Slf4j
public class ScreenOrgController {

    @Autowired
    JPAQueryFactory jpaQueryFactory;
    @Autowired
    private OrgService orgService;

    public ScreenSearchConditionDTO setOrgIdList(ScreenSearchConditionDTO dto){
        Set<Long> orgIds = new HashSet<>();
        if(dto.getOrgId() != 0){
            orgIds.add(dto.getOrgId());
        }else{
            orgIds = OrgAccountHelper.getOrgIdList();
        }
        dto.setOrgIdList(orgIds);

        return dto;
    }

}
